package com.lazily.abstract_;


/**
 * @Author:  GZQ
 * @date:  2025/2/9 22:39
 * @description: 抽象类的使用练习
 */

public class AbstractExercise01 {

	public static void main(String[] args) {
		Manager jack = new Manager("jack", 1, 10000);
		jack.setBonus(1000);
		jack.work();

		CommonEmployee tom = new CommonEmployee("tom", 1, 10000);
		tom.work();
	}
}

abstract class Employee {

	private String name;
	private int id;
	private int salary;

	public Employee(String name, int id, int salary) {
		this.name = name;
		this.id = id;
		this.salary = salary;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getSalary() {
		return salary;
	}

	public void setSalary(int salary) {
		this.salary = salary;
	}

	// 将work()做成抽象方法
	public abstract void work();
}

class Manager extends Employee {

	private int bonus;

	public Manager(String name, int id, int salary) {
		super(name, id, salary);
	}

	public int getBonus() {
		return bonus;
	}

	public void setBonus(int bonus) {
		this.bonus = bonus;
	}

	@Override
	public void work() {
		System.out.println("经理 " + getName() + " 工作中...");
	}
}

class CommonEmployee extends Employee {

	public CommonEmployee(String name, int id, int salary) {
		super(name, id, salary);
	}

	@Override
	public void work() {
		System.out.println("普通员工 " + getName() + " 工作中...");
	}
}